<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title><?php echo "$title";?></title>
        <link rel="shortcut icon" href="<?= base_url();?>system/image/icons/user-green.png" />
        <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>system/css/style2.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>system/css/jquery.flipflopfolding.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>system/css/tabel.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>system/css/jquery.autocomplete.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>system/css/redmond/jquery-ui-1.8.14.custom.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>system/css/overlay-basic.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>system/css/superfish.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>system/css/superfish-navbar.css" />
        <script type="text/javascript" src="<?php echo base_url();?>system/js/jquery-1.4.2.min.js"></script>
        <script type="text/javascript" src="<?php echo base_url();?>system/js/jquery.tools.min.js"></script>
        <script type="text/javascript" src="<?php echo base_url();?>system/js/jquery.flipflopfolding.js"></script>
        <script type="text/javascript" src="<?php echo base_url();?>system/js/jquery-ui-1.8.14.custom.min.js"></script>
        <script type="text/javascript" src="<?php echo base_url();?>system/js/jquery.autocomplete.js"></script>
        <script type="text/javascript" src="<?php echo base_url();?>system/js/workspace.js"></script>
        <script type="text/javascript" src="<?php echo base_url();?>system/js/library.js"></script>
        <script type="text/javascript" src="<?php echo base_url();?>system/js/hoverIntent.js"></script>
        <script type="text/javascript" src="<?php echo base_url();?>system/js/superfish.js"></script>
        <script type="text/javascript" src="<?php echo base_url();?>system/js/energy-saving.js"></script>
        <script type="text/javascript">
            $(document).ready(function(){
                $('.navigation').flipflopFolding();
                $('ul.navigation > li > a').addClass('active'); 

                $('#content').delegate('.datepicker-input','focusin',function(){
                    $('.datepicker-input').datepicker({
                          dateFormat: 'dd/mm/yy',
                          changeMonth: true,
                          changeYear: true
                    });
                })
                $(".ok, .error").fadeOut(5000);
                
                $(document).ready(function(){ 
                    $("ul.sf-menu").superfish({ 
                        pathClass:  'current' 
                    }); 
                }); 
            })  
        </script>
    </head>
    <body onLoad="showTime();">
    <?php
	 $row=array();
	 $date = time();
	 $day = date("d", $date);
	 $month = date("m", $date);
	 $year = date("Y", $date);
	 $month2= date("F", $date);
	 
	 $row[]= "<h3 style='margin-left: 10px'>$month2 $year </h3>
	 
	 <div align='center'>
	 ";
	 $first_day = mktime(0,0,0,$month, 1, $year);
	 $title = date("F", $first_day);
	 $day_of_week = date("D", $first_day);
	 
	 switch($day_of_week) {
	 case "Sun": $blank = 0; break;
	 case "Mon": $blank = 1; break;
	 case "Tue": $blank = 2; break;
	 case "Wed": $blank = 3; break;
	 case "Thu": $blank = 4; break;
	 case "Fri": $blank = 5; break;
	 case "Sat": $blank = 6; break;
	 }
	 
	 $days_in_month = cal_days_in_month(0, $month, $year);
	  $row[]="<table border='0' cellspacing='0' width='155'>
	  <tr><td><table border=\"0\" cellpadding=\"0\" cellspacing=\"1\" style=\" color: #000; text-align: center\">
	 <tr class='stdheaderCalendar'>
		 <td>Mng</td>
		 <td>Sen</td>
		 <td>Sel&nbsp;</td>
		 <td>Rab</td>
		 <td>Kam</td>
		 <td>Jum</td>
		 <td>Sab</td>
	 </tr>
	 <tr>	";
	 $day_count = 1;
	 $day_number = 1;
	 while($blank > 0) {
	  $row[]="	<td style='background: #ccc'></td>";
	 $blank = $blank-1;
	 $day_count++;
	 }
	 while($day_number <= $days_in_month) {
	 if($day_number < $day) {
	  $row[]="	<td style='border: 1px solid #C9C6B3; color: #000; padding: 3px'>$day_number</td>	";
	 }
	 elseif($day_number == $day) {
	  $row[]="	<td style='background: #aed2ec; border: 1px solid #555; color: #fff; padding: 3px'>$day_number</td>	";
	 }
	 else {
	  $row[]="	<td style='border: 1px solid #C9C6B3; color: #000; padding: 3px'>$day_number</td>	";
	 }
	 $day_number++;
	 $day_count++;
	 
	 if($day_count > 7) {
	  $row[]="</tr><tr>	";
	 $day_count = 1;
	 }
	 }
	 
	 while($day_count > 1 && $day_count <= 7) {
	 $row[]="<td></td>	"; 
	 $day_count++;
	 }
	 $row[]="</tr></table></td></tr></table></div>";
		
	 $showcal=implode("",$row);
    ?>    
        <div id="bar">
          <a href="<?php echo site_url('login/process_logout')?>" title="Logout"><div class="x16 exit"></div></a>
          <ul id="mainpanel">
              <li id="timepanel">
                    <a href="#"><div class="x16 time"></div><div id="maxtime"></div></a>
                <div class="subpanel"><?php
                echo $showcal;
                ?></div>
              </li>
              <li id="saldopanel">
                  <a href="#"><div class="x16 saldo"></div>Saldo</a>
                  <div class="subpanel">
                      <?php
                         foreach ($allSaldo as $saldo);
                         echo "Saldo YCAC saat ini : <b>Rp. ".rupiah($saldo[0]['saldo'])."</b>";
                      ?>
                  </div>
              </li>
              <li id="userpanel">
                  <?php
                     foreach ($user['user'] as $dataUser);
                  ?>
                  <a href="#"><div class="x16 user"></div><?php echo $dataUser['nama'];?></a>
                  <div class="subpanel">
                      Nama: <b><?php echo $dataUser['nama'];?></b> <br/>
                      Username: <b><?php echo $dataUser['username'];?></b> <br/>
                      Jenis Keanggotaan: <br /> 
                      <?php
                         foreach ($user['keanggotaan'] as $keanggotaan){
                             echo "- <b>$keanggotaan[jenis_member]</b> <br/>";
                         }
                      ?>
                      <div class="userpassword"><div class="x16 password"></div><a href=# onclick="window.location='<?php echo site_url('password');?>'">Ubah Password</a></div>
                  </div>
              </li>
          </ul>
        </div>
        <div id="nav">
          <div>
              <?php
                 echo "$menu";
              ?>
          </div>
        </div>
        <div id="content">
               <?php $this->load->view($content); ?>
               <noscript><div class="windowsjavascript" style="text-align: center;color: red;font-weight: bold"><div>Maaf Javascript pada browser anda tidak aktif.<br />Mohon aktifkan untuk menggunakan sistem ini.</div></div></noscript> 
<!--        <div class="watermark"></div>-->
        </div>
<!--       <div id="footer">
           &nbsp;
       </div>    -->
    </body>
</html>